<template>
	<el-container>
		<el-header class='x-header'>
			<b class="title">{{ page_info.title }}</b>
			<el-button v-if="$route.query.callback_url" size="mini" icon="el-icon-back" @click="g_page.funcBack">
				返回
			</el-button>
			<el-button size="mini" icon="el-icon-refresh" @click="g_page.funcReload()">刷新</el-button>
		</el-header>
		<el-main class='x-main'>
			<el-form :inline="true" :model="form_q" size="mini">
				<el-form-item label="基金代码">
					<el-input v-model="form_q.compFundCode" placeholder="基金代码"></el-input>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" @click="g_page.funcSearch">搜索</el-button>
				</el-form-item>
			</el-form>
			<div class="table-wrap">
				<el-table stripe ref="multipleTable" tooltip-effect="dark"
						  @selection-change="g_page.funcTableSelectionChange"
						  :data="list_data">
					<el-table-column type="selection"></el-table-column>
					<el-table-column label="时间">
						<template slot-scope="data">
							{{ data.row.date }}
						</template>
					</el-table-column>
					<el-table-column label="排名">
						<template slot-scope="data">
							<span style="color:blue;">
								<span v-if="data.row.rank_index >0">{{ data.row.rank_index }}</span>
								<span v-else>无排名</span>
							</span>
							/ {{ data.row.rank_total }}
						</template>
					</el-table-column>
					<el-table-column label="排名占比">
						<template slot-scope="data">
							<div>{{ data.row.proportion }}%</div>
							<b style="color: red;" v-if="!data.row.pass">不符合</b>
							<b style="color:green;" v-else>符合</b>
						</template>
					</el-table-column>
					<el-table-column label="要求占比">
						<template slot-scope="data">
							{{ data.row.proportion_set }}%
						</template>
					</el-table-column>
					<el-table-column label="涨幅">
						<template slot-scope="data">
							{{ data.row.rate }}
						</template>
					</el-table-column>
					<el-table-column label="同类平均">
						<template slot-scope="data">
							{{ data.row.avg }}
						</template>
					</el-table-column>
					<el-table-column label="深沪300">
						<template slot-scope="data">
							{{ data.row.sh300 }}
						</template>
					</el-table-column>
				</el-table>
			</div>
		</el-main>
		<!---->
		<!---->
		<!-- 分页 -->
		<el-footer v-if="page_show" class="x-page">
			<el-pagination class="paging" background layout="total, sizes, prev, pager, next, jumper"
						   @current-change="g_page.funcPageChange" :page-sizes="[page_size]"
						   :current-page="page_index" :page-size="page_size" :total="page_total">
			</el-pagination>
		</el-footer>
		<!---->
		<!---->
		<!-- 弹框 -->
		<el-dialog :title="form.app_idx+'配置'" :visible.sync="form_dialog_visible" width="70%">
			<el-form ref="form" :rules="form_rules" :model="form" size="mini" label-width="15%">
				<el-form-item label="入口链接" v-if="!g_page.funcIsAdminAdd()">
					<el-input :disabled="true" v-model="form.oauth_url"/>
				</el-form-item>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="g_page.funcBack" size="mini">取消</el-button>
				<el-button type="success" @click="g_page.funcSave" size="mini">保存</el-button>
			</div>
		</el-dialog>
		<!---->
		<!---->
		<!---->
	</el-container>
</template>


<script>
	export default {
		data() {
			let page_data = { super_uid: '' }
			//
			page_data = this.g_cc.funcGetInitData(page_data)
			//
			return page_data
		},
		mounted() {
			console.log('mounted')
			//
			this.g_page.funcSetVue(this)
			// 应用ID
			this.g_page.funcSetApiUrlList('/xadmin/sh/sh__fund_check__list')
			this.g_page.funcSetApiUrlDel('/xadmin/sh/sh__fund_check__list/del')
			//页码
			this.g_page.funcSetPageSize(30)
			//搜索
			this.form_q = {
				'compKw': ''
			}
			this.g_page.funcGetList()
			//
			this.form_rules = {
				acc_uidX: [
					{
						required: true,
						message: '必填',
						trigger: 'blur'
					}
				]
			}
			//
		},
		methods: {
			////////////////////
			//更新肋力码
			funcUpdateShareCode() {
				this.g_cc.func_confirm('确定？', () => {
					this.funcUpdateShareCodeApi()
				})
			},
			funcUpdateShareCodeApi() {
				this.g_cc.func_axios({
					url: '/xadmin/sh/sh__user__list/funcUpdateShareCode',
					data: {},
					success: (res) => {
						//
						if (res.data.errcode == 0) {
							this.g_cc.func_alert('成功')
						} else {
							this.g_cc.func_alert(res.data.errmsg, 'error')
						}
					}
					//
				})
			},
			//导出配置
			funcExportConfig() {
				let token = this.g_cc.func_get_token()
				location.href = `${BASE_API}/xadmin/sh/sh__user__list/funcExportConfig?token=${token}`
			}
			////////////////////
		}
	}
</script>
